<template>
	<view v-if="userMsg">
		<view v-if="showTop" class="bg-img bg-mask flex align-center my_user_bg" style="background-image: url('http://xingans.com/heihei/myBg.png');height: 414upx;">
			<view v-if="userMsg.handlUrl" class="cu-avatar xl round margin-left" :style="{backgroundImage:'url('+ userMsg.handlUrl +')'}"></view>
			<view class="padding-xl text-white">
				<view class="padding-xs text-xxl text-bold">
					{{userMsg.nickName?userMsg.nickName:'尚未登陆'}}
					
				</view>
				<view v-if="userMsg.identity==2" class="padding-xs text-lg">
					<view class="cu-tag bg-yellow radius" style="color: #fff;">
							平台认证律师
					</view>	
				</view>
			</view>
		</view>
		<view v-if="showTop" class="go_vip" @click="handVip">
			<image class="vip_img" src="http://xingans.com/heihei/goVip.png" mode=""></image>
		</view>
		<view class="cu-list menu sm-border">

			<view class="cu-item arrow" v-if="userMsg.isVerify!=1">
				<view class="content" @click="handInitLawyer">
					<text class="cuIcon-profile text-grey" style="color: #9BA8D7;"></text>
					<text class="text-grey">{{userMsg.isVerify==3?'成为律师 (审核中)':'成为律师'}}</text>
				</view>
			</view>
			<view class="cu-item arrow">
				<view class="content" @click="handMyConsult()">
					<text class="cuIcon-communityfill text-grey" style="color: #8AB55B;"></text>
					<text class="text-grey">我的聊天</text>
				</view>
			</view>
			<view class="cu-item arrow">
				<view class="content" @click="question">
					<text class="cuIcon-questionfill text-yellow"></text>
					<text class="text-grey">我的咨询</text>
				</view>
			</view>
			<view class="cu-item arrow">
				<view class="content" @click="collect">
					<text class="cuIcon-favorfill text-grey" style="color: #EE7D73;"></text>
					<text class="text-grey" @click="collect">我的委托</text>
				</view>
			</view>
			<view class="cu-item arrow" @click="handVip">
				<view class="content">
					<text class="cuIcon-moneybagfill text-grey" style="color: #F39937;"></text>
					<text class="text-grey">我的钱包</text>
				</view>
			</view>
			<view class="cu-item arrow" @click="colse">
				<view class="content">
					<text class="cuIcon-profile text-grey" style="color: #6CCBF1;"></text>
					<text class="text-grey">清除缓存</text>
				</view>
			</view>
		</view>
	</view>
</template>

<script>
	export default {
		props: {
			showTop: {
				type: Boolean,
				default: true
			}
		},
		data() {
			return {
				userMsg: {}
			};
		},
		mounted() {
			if (uni.getStorageSync('USER')) {
				this.userMsg = JSON.parse(uni.getStorageSync('USER'))
			}
			// if(!uni.getStorageSync('USER')||uni.getStorageSync('USER')=='null'){
			// 	uni.navigateTo({
			// 		url:'/pages/login/login'
			// 	})
			// }

		
			// this.userMsg.isVerify
		},
		methods: {
			handMyConsult(){
				uni.navigateTo({
					url:'/pages/message/myConsult/myConsult'
				})
			},
			handVip(){
				uni.showToast({
					title:'尽请期待',
					icon:'none'
				})
			},
			handInitLawyer() {
				uni.navigateTo({
					url: "/pages/message/initLawyer/initLawyer?id="+this.userMsg.isVerify
				})
			},
			colse() {
				uni.removeStorageSync('AUTH_TOKEN')
				uni.showToast({
					title:'清除成功',
					icon:'none'
				})
			},
			question() {
				uni.navigateTo({
					url: '/pages/home/my/question',
					fail: function(err) {
						console.info("跳转失败", err)
					}
				})
			},
			collect() {
				uni.navigateTo({
					url: '/pages/home/my/collect',
					fail: function(err) {
						console.info("跳转失败", err)
					}
				})
			}
		}
	}
</script>

<style lang="scss">
	.go_vip {
		text-align: center;

		.vip_img {
			width: 100%;
			height: 178upx;
		}
	}

	.my_vip {
		color: #B87D40;
		margin: 0 10upx;
	}

	.my_user_bg {
		background-repeat: no-repeat;
		background-size: 100%;
		background-position: top left !important;
	}

	.my_user_bg.bg-mask {
		background-color: #fff !important;
	}

	.bg-mask::after {
		background-color: rgba(0, 0, 0, 0) !important;
	}
</style>
